﻿using System;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;

namespace BlueBoss2
{
    // Shopping list class which will be serialized
    [XmlRoot("WatchItemList")]
    public class WatchItemList
    {
        private ArrayList listWatchItems;

        public WatchItemList()
        {
            listWatchItems = new ArrayList();
        }

        [XmlElement("WatchItem")]
        public WatchItem[] WatchItems
        {
            get
            {
                WatchItem[] watchitems = new WatchItem[listWatchItems.Count];
                listWatchItems.CopyTo(watchitems);
                return watchitems;
            }
            set
            {
                if (value == null) return;
                WatchItem[] watchitems = (WatchItem[])value;
                listWatchItems.Clear();
                foreach (WatchItem item in watchitems)
                    listWatchItems.Add(item);
            }
        }

        public int AddWatchItem(WatchItem item)
        {
            return listWatchItems.Add(item);
        }

        public void RemoveWatchItem(WatchItem item)
        {
            listWatchItems.Remove(item);
        }

        public int Count
        {
            get { return this.listWatchItems.Count; }
        }
    }

    public class WatchItem
    {
        [XmlAttribute("decicename")]
        private String _deviceName;
        [XmlAttribute("imagepath")]
        private String _picturePath;
        [XmlAttribute("progpath")]
        private String _progPath;
        [XmlAttribute("alertmessage")]
        private String _alertMessage;

        public WatchItem()
        {
        }

        public WatchItem(String DeviceName)
        {
            _deviceName = DeviceName;
        }


        public String DeviceName
        {
            get { return _deviceName; }
            set { _deviceName = value; }
        }

        public String AlertMessage
        {
            get { return _alertMessage; }
            set { _alertMessage = value; }
        }

        public String ImagePath
        {
            get { return _picturePath; }
            set { _picturePath = value; }
        }

        public String ProgramPath
        {
            get { return _progPath; }
            set { _progPath = value; }
        }

    }
}